package org.alex.netShop.pages;



import org.alex.netShop.interfaces.Product;
import org.alex.netShop.interfaces.Purchase;
import org.alex.netShop.interfaces.User;
import org.alex.netShop.service.Purchases;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;

public class ViewPurchase
{
	@Inject
	@Property
	private Purchases purchases;
	
	@Property
	private Purchase currentPurchase;
	
	public Product getFirstProduct() {
		return currentPurchase.getProduct().get(0);
	}
	
	@SessionState
	private User user;

	private boolean userExists;
	
	public User getUser() {
		return user;
	}
	
	Object onActivate() {
		if (!userExists) return Login.class;
		return null;
	}


}
